#include<stdio.h>
#include<time.h>
#include<stdlib.h>

int main()
{
	printf("请输入运算符<1 or other,1:-,other:+>:\n");
	int op;
	scanf("%d",&op);
	printf("请选择最大数(<10000)\n");
	int num;
	scanf("%d",&num);
	
	srand((unsigned int)time(0));//随机种子，随系统时间变化
	int numanwer;
	printf("请输入答案:\n");
	scanf("%d",&numanwer);
	int a,b;
	while(1)
	{
		a=rand()%num +1;
		b=rand()%num +1;
		if(op==1&&numanwer==(a-b))
		{
			printf("%d-%d=%d\n计算正确!\n",a,b,numanwer);
			break;
		}
		else if(op!=1&&numanwer==(a+b))
		{
			printf("%d+%d=%d\n计算正确!\n",a,b,numanwer);
			break;
		}
	}
	return 0;
}